<!DOCTYPE html>
<html lang="en">
<head>
<title>系统角色编辑页面</title> 
#@common()
<style type="text/css">
body { padding: 10px; background: #fff; }
.layui-form-label { min-width: 200px; }
body * {color: #393939 !important;}
</style>
</head>
<body>
	<form class="layui-form layui-fluid" action="">
		<input type="hidden" name="id" value="#(role.id)" />
		<div class="layui-row">
			<div class="layui-form-item">
				<div class="layui-col-md6 layui-col-xs6 layui-col-sm6 layui-form-label">角色名称</div>
				<div class="layui-col-md6 layui-col-xs6 layui-col-sm6">
					<input autocomplete="off" type="text" name="roleName" 
						required lay-verify="required" placeholder="请输入角色名称" class="layui-input"
						value="#(role.roleName)">
				</div>
			</div>
	  		
	  		<div class="layui-form-item" style="margin-top: 80px;">
				<div class="layui-col-md6 layui-col-xs6 layui-col-sm6 layui-col-md-offset6 layui-col-xs-offset6 layui-col-sm-offset6">
					<button class="layui-btn layui-bg-blue" lay-submit lay-filter="form">保存数据</button>
					<button type="button" class="layui-btn layui-btn-primary" onclick="closeLayer()">关闭返回</button>
				</div>
			</div>
		</div>
	</form>

	<script>
		//layui的相关数据加载
		layui.use('form', function() {
			var form = layui.form;
			//监听提交
			form.on('submit(form)', function(data) {
				Http.post('admin/role/save', data.field, function(res){
					if(res.succeed){
						parent.layer.msg('保存成功',{shade:0.1})
						closeLayer();
					} else {
						parent.layer.msg('保存失败')
					}
				})
				return false;
			});
		});
		
		/** 关闭系统菜单录入页面 */
		function closeLayer(){
			parent.jqGrid.reload();
			closeParentLayer();
		}
		
	</script>
</body>
</html>